-ifdef(comment)
(define ISA
  (list
   ;;     op             code  args  action
   ;; 0x00-0x0F: 特殊指令
   (list 'NOP            #x00  0 (lambda ()                                                                                (pc+! 1)))
   ;; 0x10-0x1F: 栈操作
   (list 'PUSH           #x10  1 (lambda () (push! (get-arg 1))                                                            (pc+! 2)))
   (list 'POP            #x11  0 (lambda () (pop!)                                                                         (pc+! 1)))
   (list 'DUP            #x12  0 (lambda () (push! (reg-ref SP))                                                           (pc+! 1)))
   (list 'SWAP           #x13  0 (lambda ()        (let* ((a (pop!)) (b (pop!))) (push! a) (push! b))                      (pc+! 1)))
   (list 'OVER           #x14  0 (lambda () (push! (reg-ref (- SP 1)))                                                     (pc+! 1)))
   ;; 0x20-0x2F: 算术运算
   (list 'ADD            #x20  0 (lambda () (push! (let* ((op2 (pop!)) (op1 (pop!)))(with-modulus MEM-LEN (mod+ op1 op2))))(pc+! 1)))
   (list 'SUB            #x21  0 (lambda () (push! (let* ((op2 (pop!)) (op1 (pop!)))(with-modulus MEM-LEN (mod- op1 op2))))(pc+! 1)))
   (list 'MUL            #x22  0 (lambda () (push! (let* ((op2 (pop!)) (op1 (pop!)))(with-modulus MEM-LEN (mod- op1 op2))))(pc+! 1)))
   (list 'DIV            #x23  0 (lambda () (push! (let* ((op2 (pop!)) (op1 (pop!)))
                                                     (if (= 0 op2)
                                                         (random MEM-LEN)          (with-modulus MEM-LEN (mod/ op1 op2)))))(pc+! 1)))
   (list 'MOD            #x24  0 (lambda () (push! (let* ((op2 (pop!)) (op1 (pop!)))
                                                     (if (= 0 op2) (random MEM-LEN) (remainder op1 op2))))                 (pc+! 1)))
   ;; 0x30-0x3F: 位运算
   (list 'AND            #x30  0 (lambda () (push! (let* ((op2 (pop!)) (op1 (pop!))) (bitwise-and op1 op2)))               (pc+! 1)))
   (list 'OR             #x31  0 (lambda () (push! (let* ((op2 (pop!)) (op1 (pop!))) (bitwise-ior op1 op2)))               (pc+! 1)))
   (list 'NOT            #x32  0 (lambda () (push! (let* ((op1 (pop!)))              (bitwise-not op1)))                   (pc+! 1)))
   ;; 0x40-0x4F: 比较运算
   (list 'EQ             #x40  0 (lambda () (push! (let* ((op2 (pop!)) (op1 (pop!))) (if      (= op1 op2)  1 0)))          (pc+! 1)))
   (list 'NEQ            #x41  0 (lambda () (push! (let* ((op2 (pop!)) (op1 (pop!))) (if (not (= op1 op2)) 1 0)))          (pc+! 1)))
   (list 'GT             #x42  0 (lambda () (push! (let* ((op2 (pop!)) (op1 (pop!))) (if     (>  op1 op2)  1 0)))          (pc+! 1)))
   (list 'GTE            #x43  0 (lambda () (push! (let* ((op2 (pop!)) (op1 (pop!))) (if     (>= op1 op2)  1 0)))          (pc+! 1)))
   (list 'LT             #x44  0 (lambda () (push! (let* ((op2 (pop!)) (op1 (pop!))) (if     (<  op1 op2)  1 0)))          (pc+! 1)))
   (list 'LTE            #x45  0 (lambda () (push! (let* ((op2 (pop!)) (op1 (pop!))) (if     (<= op1 op2)  1 0)))          (pc+! 1)))
   ;; 0x50-0x5F: 内存操作
   (list 'STORE          #x50  0 (lambda () (let* ((val (pop!)) (addr (pop!))) (set-data! addr val))                       (pc+! 1)))
   (list 'LOAD           #x51  0 (lambda () (let* ((addr (pop!))) (push! (get-data addr)))                                 (pc+! 1)))
   (list 'COPY           #x52  0 (lambda () (let* ((addr2 (pop!)) (addr1 (pop!))) (set-data! addr2 (get-data addr1)))      (pc+! 1)))
   ;; 0x60-0x6F: 控制流
   (list 'JUMP           #x60  1 (lambda ()                        (set-pc! (get-arg 1))))
   (list 'JUMPIF         #x61  1 (lambda () (if (not (= (pop!) 0)) (set-pc! (get-arg 1))                                   (pc+! 2))))
   (list 'JUMPIF-NOT     #x62  1 (lambda () (if      (= (pop!) 0)  (set-pc! (get-arg 1))                                   (pc+! 2))))
   (list 'JUMP-REL       #x63  1 (lambda ()													                           (pc+! (get-arg 1))))
   (list 'CALL           #x64  1 (lambda () (push! (+ PC 2))       (set-pc! (get-arg 1))))
   (list 'RET            #x65  0 (lambda ()                        (set-pc! (pop!))))
   ;; 0x70-0x7F: I/O操作
   (list 'PRINT          #x70  0 (lambda () (display (pop!)) (display #\newline)                                           (pc+! 1)))
   (list 'SET-UNICODE    #x71  0 (lambda () (let* ((op3 (pop!)) (op2 (pop!)) (op1 (pop!))) (set-unicode! op1 op2 op3)      (pc+! 1))))
   (list 'GET-UNICODE    #x72  0 (lambda () (let* ((op2 (pop!)) (op1 (pop!))) (get-unicode op1 op2)                        (pc+! 1))))
   ;; 0x80-0x8F: 系统功能
   (list 'RANDOM         #x73  0 (lambda () (push! (let* ((op1 (pop!)))              (random op1)))                        (pc+! 1)))
   (list 'TIME           #x74  0 (lambda () (push! (current-seconds))                                                      (pc+! 1)))
   ;; HALT 0xff
   (list 'HALT           #xff  0 (lambda ()                                                                                (pc+! 1)))
   ))
-endif.

-export